package com.turing.post.salesmanage.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @销售单持卡人实名明细
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SALEORDERREALNAMEDETAIL")
@IdClass(SaleOrderRealNameDetail.class)
public class SaleOrderRealNameDetail implements Serializable {
	/**
	 * 销售单ID
	 */
	private BigInteger saleOrderId;
	/**
	 * 批次号
	 */
	private String batchNo;
	/**
	 * 卡序号
	 */
	private String cardSeqNo;
	/**
	 * 卡号
	 */
	private String cardNo;
	/**
	 * 持卡人
	 */
	private BigInteger customId;

	private String name;
	private String idNo;

	public SaleOrderRealNameDetail() {
	}

	@Id
	@Column(name = "SALEORDERID", nullable = false)
	public BigInteger getSaleOrderId() {
		return saleOrderId;
	}

	public void setSaleOrderId(BigInteger saleOrderId) {
		this.saleOrderId = saleOrderId;
	}

	@Id
	@Column(name = "BATCHNO", nullable = false)
	public String getBatchNo() {
		return batchNo;
	}

	public void setBatchNo(String batchNo) {
		this.batchNo = batchNo;
	}

	@Id
	@Column(name = "CARDSEQNO", nullable = false)
	public String getCardSeqNo() {
		return cardSeqNo;
	}

	public void setCardSeqNo(String cardSeqNo) {
		this.cardSeqNo = cardSeqNo;
	}

	@Column(name = "CARDNO", nullable = false)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	@Column(name = "CUSTOMID", nullable = false)
	public BigInteger getCustomId() {
		return customId;
	}

	public void setCustomId(BigInteger customId) {
		this.customId = customId;
	}

	@Transient
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Transient
	public String getIdNo() {
		return idNo;
	}

	public void setIdNo(String idNo) {
		this.idNo = idNo;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((this.getBatchNo() == null) ? 0 : this.getBatchNo()
						.hashCode());
		result = prime
				* result
				+ ((this.getCardSeqNo() == null) ? 0 : this.getCardSeqNo()
						.hashCode());
		result = prime
				* result
				+ ((this.getSaleOrderId() == null) ? 0 : this.getSaleOrderId()
						.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final SaleOrderRealNameDetail other = (SaleOrderRealNameDetail) obj;
		if (this.getBatchNo() == null) {
			if (other.getBatchNo() != null)
				return false;
		} else if (!this.getBatchNo().equals(other.getBatchNo()))
			return false;
		if (this.getCardSeqNo() == null) {
			if (other.getCardSeqNo() != null)
				return false;
		} else if (!this.getCardSeqNo().equals(other.getCardSeqNo()))
			return false;
		if (this.getSaleOrderId() == null) {
			if (other.getSaleOrderId() != null)
				return false;
		} else if (!this.getSaleOrderId().equals(other.getSaleOrderId()))
			return false;
		return true;
	}
}